import request from '@/utils/request';
import { SUCCESS_CODE } from '@/utils/types.d';
import type { InvoiceTitleTableItem } from './types.d';

export async function queryInvoiceTitleList(params: any, sort: any) {
  const res = await request<{
    code: number;
    message: string;
    data: { total: number; list: InvoiceTitleTableItem[] };
  }>('/api/invoice/v1.0.0/list', {
    method: 'GET',
    params: {
      data: params,
      sort,
    },
  });
  if (res?.code === SUCCESS_CODE)
    return { success: true, total: res.data.total, data: res.data.list };
  return { success: false, total: 0, data: [] };
}
